﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using SimpleAppServer.Core;

namespace SimpleAppServer.Implement.Socket
{
    /// <summary>
    /// IPEndPoint Filter
    /// </summary>
    public class EndPointFilter : IFilter<EndPoint>
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="filters">过滤列表</param>
        public EndPointFilter(IList<EndPoint> items)
        {
            this.Items = items;
        }

        /// <summary>
        /// 过滤列表
        /// </summary>
        public IList<EndPoint> Items
        {
            get;
            set;
        }

        /// <summary>
        /// 过滤检测
        /// </summary>
        /// <param name="entity">检测项</param>
        /// <returns>是否通过</returns>
        public bool IsAllow(EndPoint item)
        {
            if (this.Items == null)
            {
                return false;
            }
            return this.Items.Contains(item);
        }
    }
}
